function getTimeLog() {
    var date = new Date();
    var year = date.getFullYear();
    var month = date.getMonth();
    var day = date.getDay();
    var hour = date.getHours();
    var min = date.getMinutes();
    var second = date.getSeconds();
    var t = "[" + year + "-"+ month + "-" + day + " " + hour + ":" + min + ":" + second + "]";
    return t;
}

var Log = (function(){
    var logConfig = {
        "msg":true,
        "debug":true,
    };
    return {
        warn:function(){
            var params = Array.prototype.slice.call(arguments,0);
            params[0] = getTimeLog() + params[0];
            console.warn.apply(console.warn,params);
        },
        debug:function(){
            if(logConfig["debug"]){
                var params = Array.prototype.slice.call(arguments,0);
                params[0] = getTimeLog() + params[0];
                console.log.apply(console.log,params);
            }
        },
        msg:function(){
           if(logConfig["msg"]){
               var params = Array.prototype.slice.call(arguments,0);
               params[0] = getTimeLog() + params[0];
               console.log.apply(console.log,params);
           }
        },
    }
})();

module.exports = Log;
